package com.rongcheng.fluxtest.stores;

import com.rongcheng.fluxtest.actions.Action;
import com.squareup.otto.Bus;

/**
 * Created by FengRongCheng on 2016/6/19 16:27.
 * powered by yanxiu.com
 */
public abstract class Store {
    private final static Bus bus = new Bus();

    public void register(final Object view) {
        this.bus.register(view);
    }

    public void unregister(final Object view) {
        this.bus.unregister(view);
    }

    //emit： 发出
    void emitStoreChange() {
        this.bus.post(storeChangeEvent());
    }

    public class StoreChangeEvent {

    }

    public abstract StoreChangeEvent storeChangeEvent();

    public abstract void onAction(Action action);
}
